function initCharts4 (data){
    $.ajax({
        type: "POST",
        // url: "/bankingRegulatory/messuage",
        url: "/assets/main/estatebanking_1.json",
        data:{city:'410100'},
        success: function (msg){
            console.log(msg)
            var myChart = echarts.init($('#prodNumber_1').get(0));
            var allData = msg.result,
                quantity1 = [],
                quantity2 = [],
                startDate = [];
            allData.forEach(function(data,index){
                quantity1[index] = data.count;
                quantity2[index] = data.count1;
                startDate[index] = (data.distrcit_name);
            });

            option = {
                title: {
                    show: 'true',
                    text: '住宅价格',
                    textStyle: {
                        color: '#ADADAD',
                        fontSize : 12
                    },
                    x: 'center'
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'cross',
                        crossStyle: {
                            color: '#999'
                        }
                    },
                    // formatter:'{b0}<br/>一手现房：{c0}</br> 一手期房：{c1}</br> 二手现房：{c2} </br>'
                    formatter: function(params) {
                        var res = '<div>';
                        res += '<strong>' + params[0].name + '</strong>'
                        for (var i = 0, l = params.length; i < l; i++) {
                            res += '<br/>' + params[i].seriesName + ' : ' + params[i].value + ' 个'
                        }
                        res += '</div>';
                        return res;
                    }
                },
                legend: {
                    // selectedMode:false,
                    orient: 'vertical',
                    bottom:'bottom',
                    data:['一手房','二手房'],
                    textStyle: {
                        color : "#ADADAD"
                    },
                },
                xAxis: [
                    {
                        type: 'category',
                        axisLabel: {
                            interval: 0,
                            rotate: 0
                        },
                        data: startDate,
                        axisLine:{
                            lineStyle:{
                                color:'#ADADAD',
                            }
                        },
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // name: '抵押率百分比',
                        axisLabel: {
                            formatter: '{value}'
                        },
                        axisLine:{
                            lineStyle:{
                                color:'#ADADAD',
                            }
                        },
                    }
                ],
                series: [
                    {
                        name:'一手房',
                        type:'bar',
                        data:quantity1
                    },
                    {
                        name:'二手房',
                        type:'bar',
                        data:quantity2
                    },
                ]
            };
            if(startDate.length>6){
                option.xAxis[0].axisLabel.rotate = 30
            }

            myChart.setOption(option);
            window.onresize = function () {
                myChart.resize()
            };
        }
    })};
initCharts4();
$('#searchData').click(function(){
    var inputData = [],
    bank = $('#bank').val();
    city = $(".everyCheckbox:checked").val();
    inputData = {
        city:city,
        bank:bank,
    };
    console.log(inputData)
    initCharts4(inputData)
});
